﻿using CinemaMaestro.DataLayer.Contracts.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CinemaMaestro.ViewModels
{
    public class SaleViewModel
    {
        public int Id { get; set; }
        public int TicketNr { get; set; }
        public int DiscountTicketNr { get; set; }
        public Double Total { get; set; }
        public string Seats { get; set; }

        public virtual ScreeningViewModel Screening { get; set; }

        public static implicit operator SaleViewModel(Sale sale)
        {
            return new SaleViewModel
            {
                Id = sale.Id,
                TicketNr = sale.TicketNr,
                DiscountTicketNr = sale.DiscountTicketNr,
                Total = sale.Total,
                Seats = sale.Seats,
                Screening = sale.Screening
            };
        }

        public static implicit operator Sale(SaleViewModel saleVM)
        {
            return new Sale
            {
                Id = saleVM.Id,
                TicketNr = saleVM.TicketNr,
                DiscountTicketNr = saleVM.DiscountTicketNr,
                Total = saleVM.Total,
                Seats = saleVM.Seats,
                Screening = saleVM.Screening
            };
        }
    }
}
